<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        //输出123
        // console.log(1);
        // setTimeout(function(){
        //     console.log(3);
        // },1000)
        // console.log(2);
        
        //输出123
        console.log(1);
        setTimeout(function(){
            console.log(3);
        },0)
        setTimeout(function(){
            console.log(4);
        },0)
        console.log(2);

        //同步任务都在主线程上执行
        //异步任务不在主线程
        //异步任务包括普通事件、回调函数、定时器等
    </script>
</body>
</html>